package com.lingnan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lingnan.entity.po.Resume;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

// ResumeMapper.java
@Mapper
public interface ResumeMapper extends BaseMapper<Resume> {

    /**
     * 根据求职者ID查询简历列表
     */
    @Select("SELECT * FROM resume WHERE seeker_id = #{seekerId} ORDER BY is_default DESC, created_at DESC")
    List<Resume> selectBySeekerIdList(@Param("seekerId") Long seekerId);
    
    /**
     * 检查简历是否有投递记录
     */
    @Select("SELECT COUNT(*) FROM job_application WHERE resume_id = #{resumeId}")
    int countApplicationsByResumeId(@Param("resumeId") Long resumeId);
}